package com.frogs.ucenter.service.daoimpl;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import com.alibaba.fastjson.JSONObject;
import com.frogs.component.permission.entity.User;
import com.frogs.system.web.api.entity.ApiUrl;
import com.frogs.ucenter.service.UploadService;
import com.frogs.ucenter.util.CommonRequestApiUtil;
import com.frogs.ucenter.util.ImageUploadUtil;

@Service("uploadService")
public class UploadServiceImpl extends CommonRequestApiUtil implements UploadService {
	
	private static Logger log = LoggerFactory.getLogger(UploadServiceImpl.class);
	
	@Override
	public JSONObject uploadImage(MultipartHttpServletRequest multipartRequest,User user) throws IllegalStateException, IOException{
    	ApiUrl apiUrl = this.buildUcenterApiBaseUrl("USER_IMG_UPLOAD");
    	return ImageUploadUtil.uploadImage(apiUrl, multipartRequest, user);
    }
}
